<template>
  <div class="box">
    <div class="top">
      <p class="title">用户量统计</p>
      <p class="bg"></p>
      <p class="make">实际用户量8589485</p>
    </div>
    <div class="counts">
      <span v-for="(item, index) in people" :key="index">{{ item }}</span>
      <span>人</span>
    </div>
    <div class="charts" ref="charts"></div>
  </div>
</template>

<script lang="ts" setup name="LeftTop">
import { onMounted, ref } from 'vue'
import * as echarts from 'echarts'
import 'echarts-liquidfill'
let people = ref('123456')
let charts = ref()
onMounted(() => {
  let mycharts = echarts.init(charts.value)
  mycharts.setOption({
    //添加标题
    title: {
      text: '',
    },
    tooltip: { show: true, type: 'axis' },
    //x|y轴的组件
    xAxis: {},
    yAxis: { show: false },
    //图表类型
    series: [
      {
        name: 'Liq',
        type: 'liquidFill',
        data: [
          { name: 'people', value: 0.6 },
          { name: 'sec', value: 0.38 },
          0.2,
        ],
        label: {
          fontSize: 28,
        },
        color: ['#10b2c3', '#00c59d', 'rgbc(136/125/263/0.85)'],
        emphasis: {
          itemStyle: {
            opacity: 0.5,
          },
        },
        itemStyle: {
          opacity: 0.6,
        },
        backgroundStyle: {
          type: '',
          borderColor: 'white',
          opacity: 0.5,
          borderWidth: 25,
          shadowBlur: 20,
        },
        outline: {
          show: true,
        },
        animationDuration: 0,
        animationDurationUpdate: 2000,
        animationEasingUpdate: 'cubicOut',
        radius: '90%',
      },
    ],
    //布局组件
    grid: {
      left: 0,
      top: 0,
      bottom: 0,
      right: 0,
    },
  })
})
</script>
<style scoped lang="scss">
.box {
  padding: 5px 15px;
  color: white;
  .top {
    .title {
      color: white;
      font-size: 20px;
      font-weight: bold;
    }
    .bg {
      height: 10px;
      margin-top: 5px;
      background: url('../../images/dataScreen-title.png') no-repeat left;
      background-size: left;
    }
    .make {
      text-align: right;
    }
  }
  .counts {
    display: flex;
    span {
      flex: 1;
      height: 60px;
      line-height: 60px;
      margin: 10px 0;
      text-align: center;
      background: url('../../images/total.png') no-repeat;
      background-size: cover;
    }
  }
  .charts {
    height: 240px;
  }
}
</style>
